<?php $db = new Mypdo(); ?>
<?php


$locManager = new LocationManager($db);
$photoManager = new PhotoManager($db);
$loc = $locManager->getLoc($_GET['id']);
$photo = $photoManager->getListByIdLoc($_GET['id']);
?>
<h2><?php echo $loc->getNomLoc(); ?></h2>

<div class="caract">
    <fieldset>
        <legend>Caracteristique :</legend>
        <table class="tableau">
            <tr>
                <td>Status :</td><td><?php echo $locManager->getStatut($loc->getIdLoc()) == true?'A Loué':'Loué'; ?></td></tr>
            <tr><td>Loyer :</td><td><?php echo $loc->getMontantLoc().'€'; ?></td></tr>
            <tr><td>Surface :</td><td><?php echo $loc->getSurfaceLoc(); ?></td></tr>
            <tr><td>Nombre de pièce :</td><td><?php echo $loc->getNbPieceLoc(); ?></td></tr>
            <tr><td>Nombre de chambre :</td><td><?php echo $loc->getNbChambreLoc(); ?></td></tr>
            <tr><td>Meublé :</td><td><?php echo $loc->getMeubleLoc() == 0?'<img id="ico" src="image/erreur.png" alt="Non Meublé">':'<img id="ico" src="image/valid.png" alt="Meublé">' ?></td></tr>
            <tr><td>Exposition :</td><td><?php
                    switch($loc->getExpositionLoc()){
                        case 'n': echo 'Nord';
                            break;
                        case 's': echo 'Sud';
                            break;
                        case 'e': echo 'Est';
                            break;
                        case 'o': echo 'Ouest';
                            break;
                    }
                    ?></td></tr>


        </table>
    </fieldset>
</div>

<div class="detail">
    <h3>Description :</h3>
    <?php echo $loc->getDescpLoc(); ?>

</div>

<div class="photo">

    <?php $nb = count($photo);
    $i = 0;
    foreach ($photo as $value) {
        $i++;
        ?>
        <a class="lightbox" href="image/upload/<?php echo $value->getLienPhoto(); ?>" title="<?php echo $value->getDescpPhoto(); ?>" data-lightbox-gallery="gallery1">
           <img class="min" src="image/upload/<?php echo $value->getLienPhoto(); ?>" alt=""  />
        </a>

        <?php
        echo $i%5?'':'<br/>';
    }
    ?>

</div>
<input id="contact" name="contact" type="button" onclick="document.location.href='index.php?page=2&id=<?php echo $_GET['id']; ?>'" value="Contacter Propriétaire" />
